package com.treasure.mall.biz.repository.user;

import com.treasure.mall.biz.entity.user.MerchantShopFollowPO;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 *
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.biz.repository.user
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/6/14 15:48
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 * Copyright 2019-2022 com.treasure.mall.biz.repository.user Inc. All rights reserved.
 */
public interface MerchantShopFollowRepository extends JpaRepository<MerchantShopFollowPO, Long> {

    /**
     * 判断当前用户是否关注过本店
     *
     * @param merchantId
     * @param userId
     * @return
     */
    long countByMerchantIdAndUserId(Long merchantId, Long userId);


    /**
     * 根据用户ID和商家ID，查询关注记录
     *
     * @param merchantId
     * @param userId
     * @return
     */
    MerchantShopFollowPO findByMerchantIdAndUserId(Long merchantId, Long userId);

    /**
     * 获取关注人数
     *
     * @param merchantId
     * @return
     */
    long countByMerchantId(Long merchantId);

}
